package com.phuc.game.andPuzzle.engine;

import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.options.EngineOptions;
import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;
import org.anddev.andengine.engine.options.WakeLockOptions;
import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;

public class InstantEngine {
	private Engine mEngine;
	private Camera mCamera;
	
	public Engine getEngine() {
		return mEngine;
	}
	
	public Camera getCamera() {
		return mCamera;
	}
	
	public InstantEngine(int width, int height, int cameraWidth, int cameraHeight, boolean isPORTRAIT) {
		mCamera = new Camera(0, 0, cameraWidth, cameraHeight);
		RatioResolutionPolicy rc =new RatioResolutionPolicy(cameraWidth, cameraHeight);
		EngineOptions eo;
		if (isPORTRAIT) {
			eo = new EngineOptions(true, ScreenOrientation.PORTRAIT, rc, mCamera).setNeedsSound(true).setNeedsMusic(true).setWakeLockOptions(WakeLockOptions.SCREEN_ON);
		} else {
			eo = new EngineOptions(true, ScreenOrientation.LANDSCAPE, rc, mCamera).setNeedsSound(true).setNeedsMusic(true).setWakeLockOptions(WakeLockOptions.SCREEN_ON);;
		}
		mEngine = new Engine(eo);
	}
}
